import { v4 as uuidv4 } from 'uuid'

// 定义一个生成uuid的逻辑函数
export const getTempId = () => {
  // 当本地存储有的时候
  const result = localStorage.getItem('userTempId')
  if (result) {
    return result
  } else {
    const newTempId = uuidv4()
    // 存储到本地
    localStorage.setItem('userTempId', newTempId)
    return newTempId
  }
}
